PyLayers

A Site-Specific Mobile Indoor Radio Channel Modeling Platform

From Graph-Based Ray Tracing to Indoor Positioning

Overview

2014

What is PyLayers ?

  • PyLayers is Open Source
  • PyLayers is an evolutive platform for education and research in radio propagation
  • PyLayers is a radio propagation simulator fully written in Python langage
  • PyLayers is organized as a set of specialized independent modules
    • Good for maintainability and further evolution
  • PyLayers adresses the prediction of radio observable for localization in Indoor environments
  • PyLayers adresses various radio standard including UWB radio
  • PyLayers adresses realistic human mobility and motion
  • PyLayers aims to connect with upper Layer abstraction

List of the main modules

Layout of Indoor Environments

  • The very first thing to do, is to describe the selected propagation environement.
  • The manner this environement is described has very strong implications on rays algoritms performances.
  • The design choice which has been made, is to heavily relying on the graph data structure

To go further, we need to import the following specialized module

In [2]:
from pylayers.gis.layout import *
<matplotlib.figure.Figure at 0x85465d0>

Loading a Floor Plan (Layout)

  • The chosen environement corresponds to the office building where an UWB Impulse Radio measurement campaign took place during the WHERE1 FP7 project.
  • Several format are supported (including .osm)
In [3]:
L=Layout('WHERE1.ini')
f = figure(figsize(30,30))
plt.axis('off')
f,a = L.showG('r',nodes=True,node_size=80,node_color='g',edge_color='b',width=5,fig=f)
t = plt.title('Graph of rooms',fontsize=40)

Graph of Ways

In [4]:
f = figure(figsize(30,30))
plt.axis('off')
f,a = L.showG('w',nodes=True,node_size=80,node_color='c',edge_color='k',width=1,fig=f)
t =plt.title('Graph of Ways',fontsize=40)

Link Simulation

For enabling electromagnetic simulation we load the following modules

  • radionode
    • coordinates
    • 3D orientation
    • antenna object
  • link
    • 2 RadioNode
    • 1 Layout
In [5]:
from pylayers.simul.radionode import *
from pylayers.simul.link import *

Loading the Tx and Rx points from the WHERE1-M1 measurement campaign.

In [6]:
rx = RadioNode(_fileini='w2m1rx.ini',_fileant='defant.vsh3')
tx = RadioNode(_fileini='w2m1tx.ini',_fileant='defant.vsh3')

Link Simulation

  • Links are saved in hdf5 format
  • All Links data members are evaluated once and stored
In [18]:
#Lk = DLink(L=L,a=tx.points[1],b=rx.points[54],cutoff=5,verbose=False)
Lk = DLink(L=L,a=tx.points[2],b=rx.points[114],cutoff=5,verbose=False)
Lk.eval()
f,a = Lk.show(labels=False)
> /home/uguen/Documents/rch/devel/pylayers/pylayers/antprop/signature.py(1764)run5()
-> for k in dout.keys():
(Pdb) l
1759 	                    except:
1760 	                        dout[1]=[]
1761 	                        dout[1].append(self.L.di[s])
1762 	
1763 	        pdb.set_trace()
1764 ->	        for k in dout.keys():
1765 	            adout=np.array((dout[k]))
1766 	            shad = np.shape(adout)
1767 	            # manage the case of signatures with only 1 interaction
1768 	            if k == 1:
1769 	                adout=adout.reshape(shad[0],1,shad[1])
(Pdb) c

Main Link members

The Signature .Si

In [19]:
Lk.Si.keys()
print Lk.Si[12].shape
print Lk.Si[12][0,:]
print Lk.Si[12][1,:]
(2340, 12)
[ 29 135 140   5 140 135  46 136  70 136 336  44]
[2 2 2 1 2 2 2 2 1 2 1 2]

  • Signatures are rays potentialities
  • A set of Signature is calculated from one Layout cycle to an other Layout cycle
  • A Signature consists of 2 lists
    • A list of interaction entities (point (<0) or segment (>0))
    • A list of type of interactions (1:R, 2:T, 3:D)
  • The same signature is used for calculation of rays from one cycle to an other cycle

Main Link Members

The Rays .R

In [20]:
Lk.R
Out[20]:
Rays3D
----------
1 / 1 : [0]
2 / 6 : [1 2 3 4 5 6]
3 / 19 : [ 7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25]
4 / 40 : [26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65]
5 / 69 : [ 66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83
  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101
 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134]
6 / 118 : [135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
 243 244 245 246 247 248 249 250 251 252]
7 / 139 : [253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
 379 380 381 382 383 384 385 386 387 388 389 390 391]
8 / 100 : [392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
 482 483 484 485 486 487 488 489 490 491]
9 / 14 : [492 493 494 495 496 497 498 499 500 501 502 503 504 505]
10 / 4 : [506 507 508 509]
-----
ni : 3222
nl : 6954

Group of rays with 3 interactions

In [21]:
c = plt.cm.jet
col = c(1.0)
f,a = Lk.R.show(L=Lk.L,figsize=(20,20),i=3,alpharay=0.3,widthray=5,colray=col)

Group of rays with 4 interactions

In [22]:
f,a = Lk.R.show(L=Lk.L,figsize=(30,30),i=4,widthray=2,colray='m')

All group of rays (from 3 to 9 interactions)

In [23]:
f,a=Lk.show(rays=True,col='cmap',pol='tot',dB=True,cmap=cm.hot,dyn=50,labels=False)
f,a=Lk.show(rays=True,col='cmap',pol='tot',dB=True,cmap=cm.hot,dyn=120,labels=False)
In [24]:
f,a=Lk.show(rays=True,col='cmap',pol='tt',dB=True,cmap=cm.hot,dyn=50,labels=False)
f,a=Lk.show(rays=True,col='cmap',pol='pp',dB=True,cmap=cm.hot,dyn=50,labels=False)
In [25]:
Ett,Etp,Epp,Ept = Lk.C.energy()
Etot = Ett+Etp+Epp+Ept
semilogy(Etot)
Out[25]:
[<matplotlib.lines.Line2D at 0x7f7d497f6550>]
In [26]:
Lk.R[4]['rayidx']
Out[26]:
array([26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
       43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
       60, 61, 62, 63, 64, 65])
In [27]:
clm = cm.copper
f,a = Lk.show()
#rk  = Lk.R.keys()[::-1]
rk  = Lk.R.keys()
for i  in rk:
    lr = Lk.R[i]['rayidx']
    for r in range(len(lr)):
        ir = lr[r]
        RayEnergy=max((10*log(Etot[ir]/Etot.max())+40),0)/40
        col = clm(RayEnergy)
        f,a = Lk.R.show(i=i,r=r,colray=col,widthray=RayEnergy,alpharay=RayEnergy,fig=f,ax=a,layout=False,points=False)

Main Link members

The Propagation Channel .C

  • \(\mathbf{\tilde{C}(f)} = \left[\matrix { C_{\theta,\theta} & C_{\theta,\phi}\\C_{\phi,\theta} & C_{\phi,\phi}}\right]\)
In [48]:
Lk.C
Out[48]:
Ctilde
---------
(190, 181)
Nray : 190
fmin(GHz) : 2.0
fmax(GHz): 11.0
Nfreq : 181
Methods
---------
 prop2tran(a=theta,b=phi,Friis=False)
 energy()
 doadod(cmap=plt.cm.hot_r,s=30,fontsize=12,phi=(0,360))
 mobility(v,dt)
 show(mode=linear)
 sort()

The propagation channel

  • Full polarization
  • Full frequency
  • Full angular information
  • At that stage there is no antenna involved
  • Vertical axis is the ray index
In [28]:
Lk.C.sort('energy')
f,a= Lk.C.show(cmap='jet',fontsize=40,typ='l20',vmin=-120,vmax=-30)
In [29]:
Lk.C.sort('tauk')
f,a=Lk.C.show(cmap='jet',fontsize=40,typ='l20',vmax=-30,vmin=-120)
In [30]:
Lk.C.sort('tauk')
f,a=Lk.C.show(cmap='jet',fontsize=40,typ='r')

It is possible to truncate the propagation at a given energy threshold. Warning, this operation is not reversible.

In [52]:
#Lk.C.cut(threshold=0.99)
#Lk.C.sort('tauk')
#f,a=Lk.C.show(cmap='jet',fontsize=40,typ='l20',vmax=-30,vmin=-120)

To vizualize an individual ray: + i : group of rays + r : index of the ray in the group of rays

In [31]:
Lk.R
Out[31]:
Rays3D
----------
1 / 1 : [0]
2 / 6 : [1 2 3 4 5 6]
3 / 19 : [ 7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25]
4 / 40 : [26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65]
5 / 69 : [ 66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83
  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101
 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134]
6 / 118 : [135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
 243 244 245 246 247 248 249 250 251 252]
7 / 139 : [253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
 379 380 381 382 383 384 385 386 387 388 389 390 391]
8 / 100 : [392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
 482 483 484 485 486 487 488 489 490 491]
9 / 14 : [492 493 494 495 496 497 498 499 500 501 502 503 504 505]
10 / 4 : [506 507 508 509]
-----
ni : 3222
nl : 6954

In [32]:
Lk.R.show(L=Lk.L,i=4,r=-1,colray='green',widthray=1,figsize=(20,20))
Out[32]:
(<matplotlib.figure.Figure at 0x7f7d48770b50>,
 <matplotlib.axes.AxesSubplot at 0x11aa0550>)

Main Link members

The transmission channel .T

In [33]:
f,la=Lk.H.show(cmap='jet',fontsize=40)

Internal Description of Complex Signals

Materials and Slabs

Antennas and Propagation

Simulation of a Radio Link

Handling human mobility

Comparison with measurements

Thanks!

In [57]:
from IPython.display import display, HTML
s = """

<style>

.rendered_html {
    font-family: "proxima-nova", helvetica;
    font-size: 150%;
    line-height: 1.3;
}

.rendered_html h1 {
    margin: 0.25em 0em 0.5em;
    color: #015C9C;
    text-align: center;
    line-height: 1.2; 
    page-break-before: always;
}

.rendered_html h2 {
    margin: 1.1em 0em 0.5em;
    color: #26465D;
    line-height: 1.2;
}

.rendered_html h3 {
    margin: 1.1em 0em 0.5em;
    color: #002845;
    line-height: 1.2;
}

.rendered_html li {
    line-height: 1.5; 
}

.prompt {
    font-size: 120%; 
}

.CodeMirror-lines {
    font-size: 120%; 
}

.output_area {
    font-size: 120%; 
}

notebook {
    background-image: url('files/images/background.png');
}

h1.bigtitle {
    margin: 4cm 1cm 4cm 1cm;
    font-size: 300%;
}

h3.point {
    font-size: 200%;
    text-align: center;
    margin: 2em 0em 2em 0em;
    #26465D
}

.logo {
    margin: 20px 0 20px 0;
}

a.anchor-link {
    display: none;
}

h1.title { 
    font-size: 250%;
}

</style>
"""
display(HTML(s))